package com.mlnx.work.utils;

import com.mlnx.work.constant.GlobalConstant;

import java.util.ArrayList;
import java.util.List;

public class TagUtil {
    /**
     * 标签解析
     *
     * @return
     */
    public static List<String> getTags(String tags) {
        List<String> tagNames = new ArrayList<>();

        if (tags == null || tags.trim().length() <= 0)
            return null;

        String[] arr;
        try {
            arr = tags.split(",");
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }

        if (arr.length <= 0) {
            return null;
        }

        for (String tagId : arr) {
            tagNames.add(GlobalConstant.TAGS.get(Integer.parseInt(tagId)));
        }

        return tagNames;
    }
}
